package net.com.sunkey.messagehandler;

import java.nio.ByteBuffer;

import net.com.sunkey.protobuf.Protocol;
import net.com.sunkey.serverlogic.Message;
import net.com.sunkey.serverlogic.Server;

/**
 * @author kohachiro
 *
 */
public class ServerErrorResponseHandler{
	/* (non-Javadoc)
	 * @see com.sunkey.tdserver.messagehandler.MessageHandler#invoke(java.lang.Object, org.jboss.netty.channel.Channel)
	 */
	//@Override
	public static int invoke(Object obj, Object channel){
		System.out.println("["+channel.hashCode()+"]["+ Protocol.MessageHandler.ServerErrorResponse_VALUE+"]ServerErrorResponse:"+(int)obj);
		try {
			Server.sendResponse(Protocol.MessageHandler.ServerErrorResponse_VALUE, ByteBuffer.wrap(Message.toByteArray((int)obj)), channel);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Protocol.MessageHandler.ServerErrorResponse_VALUE;
	}
}
